#include "LinkLayer.h"
void LinkLayer::Exec(string s) {
	if (s == "UP") {
		for (int i = 0; i < 2; i++) {
			data.erase(data.begin());
			data.pop_back();
		}
	}
	else if (s == "DOWN") {
		bit head_a;
		head_a.value = 1;
		data.insert(data.begin(), head_a);
		head_a.value = 1;
		data.insert(data.begin(), head_a);
		bit tail_a;
		tail_a.value = 0;
		data.insert(data.end(), tail_a);
		tail_a.value = 0;
		data.insert(data.end(), tail_a);
	}
}

vector<bit> LinkLayer::Send() {
	return data;
}

void LinkLayer::Recv(vector<bit> b) {
	data = b;
}

void LinkLayer::SayHello() {
	cout << "Hi, This is LinkLayer" << endl;
}

int LinkLayer::len() {
	return data.size();
}